def average(values):
    """Computes the arithmetic mean of a list of numbers.

    >>> print(average([20, 30, 70]))
    40.0
    """
    return sum(values) / len(values)

import doctest

print(doctest.testmod())

import reprlib
print(set('supercalifragilisticexpialidocious'))
print(reprlib.repr(set('supercalifragilisticexpialidocious')))

from string import Template
t = Template('${village}folk send $$10 to $cause.')
print(t.substitute(village='Nottingham', cause='the ditch fund'))
# 'Nottinghamfolk send $10 to the ditch fund.'


import threading, zipfile

class AsyncZip(threading.Thread):
    def __init__(self, infile, outfile):
        threading.Thread.__init__(self)
        self.infile = infile
        self.outfile = outfile

    def run(self):
        f = zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED)
        f.write(self.infile)
        f.close()
        print('Finished background zip of:', self.infile)

background = AsyncZip('test.py', 'test.zip')
background.start()
print('The main program continues to run in foreground.')

background.join()    # Wait for the background task to finish
print('Main program waited until background was done.')

data = [1,3,5,0,4,6,8,9,2]
from heapq import heapify,heappop,heappush
heapify(data)
heappush(data, -4)
print([heappop(data) for i in range(3)]) # -4 0 1


from decimal import *

print(Decimal(Decimal('0.70') * Decimal('1.05')))

print(sum([Decimal('0.1')] * 10) == Decimal('1.0'))

print(sum([Decimal('0.1')] * 10) == Decimal('1.0'))